<?php

class Test_Abovo_View_Helper_TimestampNice extends Solar_Test {
    
    protected $_view;
    
    protected $_class;
    
    public function __construct($config = array())
    {
        parent::__construct($config);
        
        $this->_view = Solar::factory('Solar_View');
        $this->_view->setHelperClass('Abovo_View_Helper');
        
        $this->_class = 'Abovo_Date';
    }
    
    public function testSeconds()
    {
        $time = time() - 59;
        $this->assertSame(
            $this->_view->timestampNice('@' . $time),
            Solar::$locale->fetch($this->_class, 'PAST_SECOND')
        );
        
        //
        $time = time() + 59;
        $this->assertSame(
            $this->_view->timestampNice('@' . $time),
            Solar::$locale->fetch($this->_class, 'FUTURE_SECOND')
        );
    }
    
    public function testMinute()
    {
        $time = time() - 60;
        $this->assertSame(
            $this->_view->timestampNice('@' . $time),
            Solar::$locale->fetch($this->_class, 'PAST_MINUTE')
        );
        
        $time = time() + 60;
        $this->assertSame(
            $this->_view->timestampNice('@' . $time),
            Solar::$locale->fetch($this->_class, 'FUTURE_MINUTE')
        );
    }
    
    public function testMinutes()
    {
        $time = time() - 121;
        $this->assertSame(
            $this->_view->timestampNice('@' . $time),
            sprintf(Solar::$locale->fetch($this->_class, 'PAST_MINUTE', 2), 2)
        );
    }
}